<?php
namespace application\views;

class Error extends \application\auth\Normal {

	public function load($error) {
		global $concerto;
		require_once CN_APPLICATION_PATH.'application/functions/front-end.php';
		
		$page = $concerto->UrlInterpreter->currentUrl;
		/**$insert = array('pv_page'=>$page, 'pv_ip'=>$_SERVER['REMOTE_ADDR'], 'pv_type'=>'error', 'pv_error'=>$error);
		DB()->insert('cn_pageviews', $insert);*/
		
		
		
		if(file_exists(templateDir().'error.php')) {
			require templateDir().'error.php';
		}
		else {
			switch($error) {
				case ERROR_CONTENT_NOT_FOUND:
					$title = 'Error: 404';
					$content = "It looks like the item you're looking for doesn't exist on our server. We apologize for any inconvience.";
					break;
				case ERROR_UNMATCHED_URL_QUERY:
					$title = 'Error: Ambiguous URL';
					$content = "The URL you are using can refer to two or more pieces of content. Please recheck and try again.";
					break;
				case ERROR_UNMATCHED_PERMALINK_GENEOLOGY:
					$title = 'Error: Mismatched URL';
					$content = "The content you are looking for cannot be accessed using this URL. Please try again.";
					break;
				case ERROR_MISSING_TEMPLATE_FILE:
					$title = 'Error: Missing Template File';
					$content = "There is no template file for displaying the content you are trying to access. The system administrator has been made aware of this issue and it will be fixed soon.";
					break;
				case ERROR_INACCESSIBLE:
					$title = 'Error: Inaccessible';
					$content = "The content you are trying to access is inaccessible using the current method. Please go back and try again.";
					break;
			
			}
			require CN_APPLICATION_PATH.'application/htmlincludes/error.php';
		}
		exit();
	}
}
?>